package demo1;

import java.util.Arrays;

public class Test2 {

    public static String myToString(int[] arr) {
        String str = "";
        str += "[";
        for (int i = 0; i < arr.length-1; i++) {
            str = str + arr[i] + ", ";
        }
        str = str + arr[arr.length-1] + "]";
        return str;
    }

    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        System.out.println(Arrays.toString(arr));
        String str = myToString(arr);
        System.out.println(str);
    }

}
